<template>
  <div class="daily-progress">
    <div class="container">
      <header>
        <p>YOUR DAILY</p>
        <h2>PROGRESS</h2>
      </header>

      <main>
        <section class="calorie tracker">
          <p class="val">2758</p>
          <p>kcal</p>
          <svg viewBox="0 0 100 100">
            <circle cx="50" cy="50" r="40" class="black" />
            <circle cx="50" cy="50" r="40" class="green val-bar" />
          </svg>
        </section>

        <section class="walk">
          <div class="steps tracker">
            <p class="val">8563</p>
            <p>steps</p>
            <svg viewBox="0 0 100 100">
              <circle cx="50" cy="50" r="40" class="black" />
              <circle cx="50" cy="50" r="40" class="blue val-bar" />
            </svg>
          </div>
          <div class="km tracker">
            <p class="val">6.2</p>
            <p>km</p>
            <svg viewBox="0 0 100 100">
              <circle cx="50" cy="50" r="40" class="black" />
              <circle cx="50" cy="50" r="40" class="blue val-bar" />
            </svg>
          </div>
        </section>
      </main>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.daily-progress {
  width: 100%;
  height: 100%;

  display: grid;
  place-items: center;

  .container {
    width: 400px;
    height: 400px;
    border: 1px solid black;
    background-color: #253b48;
    color: #fff;
    border-radius: 5px;
    box-shadow: 1px 1px 5px #413f3f;

    display: flex;
    flex-direction: column;
    align-items: center;
    /* justify-content: center; */
    $barload-anim-prop: 1.5s ease-out forwards;
    header {
      padding: 20px;
      text-align: center;
    }
    main {
      width: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;

      .val {
        font-size: 1.2rem;
      }

      .tracker {
        color: lighten(#577383, 10%);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;

        svg {
          width: 100%;
          height: 100%;
          fill: none;
          position: absolute;
          left: 0%;
          top: 0%;

          .black {
            stroke: black;
          }

          .val-bar {
            stroke-linecap: round;
            transform-origin: 50% 50%;
            transform: rotateZ(-85deg);
          }
        }
      }

      .calorie {
        width: 8rem;
        height: 8rem;
        position: relative;
        svg {
          stroke-width: 0.42rem;
          .green {
            stroke: #27e1ae;
            stroke-dasharray: 251;
            animation: barload1 1.5s ease-out forwards;

            @keyframes barload1 {
              0% {
                stroke-dashoffset: 251;
              }
              100% {
                stroke-dashoffset: 50;
              }
            }
          }
        }
      }

      .walk {
        margin-top: 10px;
        width: 60%;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .steps {
          width: 7rem;
          height: 7rem;

          svg {
            stroke-width: 0.39rem;

            .blue {
              stroke: rgb(49, 209, 209);
              stroke-dasharray: 251;

              animation: barload2 1.5s ease-in-out forwards;

              @keyframes barload2 {
                from {
                  stroke-dashoffset: 251;
                }
                to {
                  stroke-dashoffset: 90;
                }
              }
            }
          }
        }

        .km {
          width: 6rem;
          height: 6rem;

          svg {
            stroke-width: 0.36rem;

            .blue {
              stroke: rgb(212, 224, 42);
              stroke-dasharray: 251;

              animation: barload3 1.5s ease-in-out forwards;

              @keyframes barload3 {
                from {
                  stroke-dashoffset: 251;
                }
                to {
                  stroke-dashoffset: 180;
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>
